<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 500px;
            height: 500px;
            background: #ccc;
            color: white;
            font-size: 100px;
            text-align: center;
        }
    </style>
</head>
<body>
    <div></div>
    <script src="../js/lodash.min.js"></script>
    <script>
        let box = document.querySelector('div')
        let i =1
        function fun(){
            box.innerHTML=i++
        }
        box.addEventListener('mousemove',_.debounce(fun,500))

        function time(e,i){
            let timer
            return function(){
                if(timer)clearTimeout(timer)
                timer=setTimeout(function (){
                    e()
                },i)
            }
        }
        box.addEventListener('mousemove',time(fun,500))
    </script>
</body>
</html>